var chart1 = null, sectionChart = null, sectionChart2 = null;
var returnListTab2Chart = [],forecastYear=2008;

function PIIFactory() {
    this.piiMap = {
        '廖坊水文模型1': [
            { "P": "0.01", "x": "0", "y": "34.05" },
            { "P": "0.0333", "x": "0.315810296", "y": "31.8" },
            { "P": "0.05", "x": "0.428489754", "y": "31.02" },
            { "P": "0.1", "x": "0.628784179", "y": "29.66" },
            { "P": "0.2", "x": "0.840854746", "y": "28.26" },
            { "P": "0.3333", "x": "1.005931458", "y": "27.2" },
            { "P": "0.5", "x": "1.143187182", "y": "26.33" },
            { "P": "1", "x": "1.392668611", "y": "24.79" },
            { "P": "2", "x": "1.665267575", "y": "23.16" },
            { "P": "3.3333", "x": "1.885097359", "y": "21.89" },
            { "P": "5", "x": "2.074162859", "y": "20.83" },
            { "P": "10", "x": "2.43746492", "y": "18.88" },
            { "P": "20", "x": "2.877395252", "y": "16.64" },
            { "P": "25", "x": "3.044526735", "y": "15.84" },
            { "P": "30", "x": "3.194615973", "y": "15.13" },
            { "P": "40", "x": "3.465669382", "y": "13.89" },
            { "P": "50", "x": "3.719016485", "y": "12.78" },
            { "P": "60", "x": "3.972363589", "y": "11.72" },
            { "P": "70", "x": "4.243416998", "y": "10.63" },
            { "P": "75", "x": "4.393506236", "y": "10.05" },
            { "P": "80", "x": "4.560637719", "y": "9.43" },
            { "P": "85", "x": "4.755449875", "y": "8.72" },
            { "P": "90", "x": "5.000568051", "y": "7.87" },
            { "P": "95", "x": "5.363870112", "y": "6.67" },
            { "P": "97", "x": "5.599810094", "y": "5.95" },
            { "P": "99", "x": "6.045364359", "y": "4.66" },
            { "P": "99.9", "x": "6.809248792", "y": "2.74" },
            { "P": "99.99", "x": "7.438032971", "y": "1.4" }],
        '廖坊水文模型2': [
            { "P": "0.03", "x": "1.79", "y": "20.7166464" },
            { "P": "0.05", "x": "2.11", "y": "20.5573248" },
            { "P": "0.08", "x": "2.32", "y": "19.966608" },
            { "P": "0.11", "x": "2.48", "y": "19.69457666" },
            { "P": "0.14", "x": "2.62", "y": "19.000224" },
            { "P": "0.16", "x": "2.73", "y": "18.7094016" },
            { "P": "0.19", "x": "2.84", "y": "17.7753312" },
            { "P": "0.22", "x": "2.93", "y": "17.08122452" },
            { "P": "0.24", "x": "3.02", "y": "16.9799328" },
            { "P": "0.27", "x": "3.11", "y": "16.1327808" },
            { "P": "0.30", "x": "3.19", "y": "15.3905184" },
            { "P": "0.32", "x": "3.26", "y": "15.2676576" },
            { "P": "0.35", "x": "3.34", "y": "14.9663808" },
            { "P": "0.38", "x": "3.41", "y": "14.59461954" },
            { "P": "0.41", "x": "3.48", "y": "14.55886151" },
            { "P": "0.43", "x": "3.55", "y": "13.67473338" },
            { "P": "0.46", "x": "3.62", "y": "13.3723872" },
            { "P": "0.49", "x": "3.69", "y": "12.879216" },
            { "P": "0.51", "x": "3.75", "y": "12.3779232" },
            { "P": "0.54", "x": "3.82", "y": "12.3221088" },
            { "P": "0.57", "x": "3.89", "y": "11.1924288" },
            { "P": "0.59", "x": "3.96", "y": "10.7904096" },
            { "P": "0.62", "x": "4.03", "y": "10.4095584" },
            { "P": "0.65", "x": "4.10", "y": "10.16932603" },
            { "P": "0.68", "x": "4.17", "y": "10.16243292" },
            { "P": "0.70", "x": "4.25", "y": "10.08884892" },
            { "P": "0.73", "x": "4.33", "y": "9.824112" },
            { "P": "0.76", "x": "4.41", "y": "9.6108768" },
            { "P": "0.78", "x": "4.50", "y": "9.4217472" },
            { "P": "0.81", "x": "4.60", "y": "8.9798976" },
            { "P": "0.84", "x": "4.70", "y": "8.9356608" },
            { "P": "0.86", "x": "4.82", "y": "8.6519232" },
            { "P": "0.89", "x": "4.96", "y": "8.6242752" },
            { "P": "0.92", "x": "5.12", "y": "7.963701639" },
            { "P": "0.95", "x": "5.33", "y": "6.1652448" },
            { "P": "0.97", "x": "5.65", "y": "5.8335552" }],
        '廖坊水文模型3': [
            { "P": "66.49", "x": "4.486826608", "y": "9.7" }
        ],
        '廖坊统计模型1': [
            { "P": "0.01", "x": "0", "y": "34.05" },
            { "P": "0.0333", "x": "0.315810296", "y": "31.8" },
            { "P": "0.05", "x": "0.428489754", "y": "31.02" },
            { "P": "0.1", "x": "0.628784179", "y": "29.66" },
            { "P": "0.2", "x": "0.840854746", "y": "28.26" },
            { "P": "0.3333", "x": "1.005931458", "y": "27.2" },
            { "P": "0.5", "x": "1.143187182", "y": "26.33" },
            { "P": "1", "x": "1.392668611", "y": "24.79" },
            { "P": "2", "x": "1.665267575", "y": "23.16" },
            { "P": "3.3333", "x": "1.885097359", "y": "21.89" },
            { "P": "5", "x": "2.074162859", "y": "20.83" },
            { "P": "10", "x": "2.43746492", "y": "18.88" },
            { "P": "20", "x": "2.877395252", "y": "16.64" },
            { "P": "25", "x": "3.044526735", "y": "15.84" },
            { "P": "30", "x": "3.194615973", "y": "15.13" },
            { "P": "40", "x": "3.465669382", "y": "13.89" },
            { "P": "50", "x": "3.719016485", "y": "12.78" },
            { "P": "60", "x": "3.972363589", "y": "11.72" },
            { "P": "70", "x": "4.243416998", "y": "10.63" },
            { "P": "75", "x": "4.393506236", "y": "10.05" },
            { "P": "80", "x": "4.560637719", "y": "9.43" },
            { "P": "85", "x": "4.755449875", "y": "8.72" },
            { "P": "90", "x": "5.000568051", "y": "7.87" },
            { "P": "95", "x": "5.363870112", "y": "6.67" },
            { "P": "97", "x": "5.599810094", "y": "5.95" },
            { "P": "99", "x": "6.045364359", "y": "4.66" },
            { "P": "99.9", "x": "6.809248792", "y": "2.74" },
            { "P": "99.99", "x": "7.438032971", "y": "1.4" }
        ],
        '廖坊统计模型2': [
            { "P": "0.03", "x": "1.79", "y": "20.7166464" },
            { "P": "0.05", "x": "2.11", "y": "20.5573248" },
            { "P": "0.08", "x": "2.32", "y": "19.966608" },
            { "P": "0.11", "x": "2.48", "y": "19.69457666" },
            { "P": "0.14", "x": "2.62", "y": "19.000224" },
            { "P": "0.16", "x": "2.73", "y": "18.7094016" },
            { "P": "0.19", "x": "2.84", "y": "17.7753312" },
            { "P": "0.22", "x": "2.93", "y": "17.08122452" },
            { "P": "0.24", "x": "3.02", "y": "16.9799328" },
            { "P": "0.27", "x": "3.11", "y": "16.1327808" },
            { "P": "0.30", "x": "3.19", "y": "15.3905184" },
            { "P": "0.32", "x": "3.26", "y": "15.2676576" },
            { "P": "0.35", "x": "3.34", "y": "14.9663808" },
            { "P": "0.38", "x": "3.41", "y": "14.59461954" },
            { "P": "0.41", "x": "3.48", "y": "14.55886151" },
            { "P": "0.43", "x": "3.55", "y": "13.67473338" },
            { "P": "0.46", "x": "3.62", "y": "13.3723872" },
            { "P": "0.49", "x": "3.69", "y": "12.879216" },
            { "P": "0.51", "x": "3.75", "y": "12.3779232" },
            { "P": "0.54", "x": "3.82", "y": "12.3221088" },
            { "P": "0.57", "x": "3.89", "y": "11.1924288" },
            { "P": "0.59", "x": "3.96", "y": "10.7904096" },
            { "P": "0.62", "x": "4.03", "y": "10.4095584" },
            { "P": "0.65", "x": "4.10", "y": "10.16932603" },
            { "P": "0.68", "x": "4.17", "y": "10.16243292" },
            { "P": "0.70", "x": "4.25", "y": "10.08884892" },
            { "P": "0.73", "x": "4.33", "y": "9.824112" },
            { "P": "0.76", "x": "4.41", "y": "9.6108768" },
            { "P": "0.78", "x": "4.50", "y": "9.4217472" },
            { "P": "0.81", "x": "4.60", "y": "8.9798976" },
            { "P": "0.84", "x": "4.70", "y": "8.9356608" },
            { "P": "0.86", "x": "4.82", "y": "8.6519232" },
            { "P": "0.89", "x": "4.96", "y": "8.6242752" },
            { "P": "0.92", "x": "5.12", "y": "7.963701639" },
            { "P": "0.95", "x": "5.33", "y": "6.1652448" },
            { "P": "0.97", "x": "5.65", "y": "5.8335552" }
        ],
        '廖坊统计模型3': [
            { "P": "54.5", "x": "3.832055026", "y": "12.3" }
        ],
        '娄家村水文模型1': [
            { "P": "0.01", "x": "0", "y": "117.82" },
            { "P": "0.0333", "x": "0.315810296", "y": "111.29" },
            { "P": "0.05", "x": "0.428489754", "y": "109" },
            { "P": "0.1", "x": "0.628784179", "y": "105" },
            { "P": "0.2", "x": "0.840854746", "y": "100.84" },
            { "P": "0.3333", "x": "1.005931458", "y": "97.66" },
            { "P": "0.5", "x": "1.143187182", "y": "95.06" },
            { "P": "1", "x": "1.392668611", "y": "90.41" },
            { "P": "2", "x": "1.665267575", "y": "85.46" },
            { "P": "3.3333", "x": "1.885097359", "y": "81.58" },
            { "P": "5", "x": "2.074162859", "y": "78.3" },
            { "P": "10", "x": "2.43746492", "y": "72.18" },
            { "P": "20", "x": "2.877395252", "y": "65.09" },
            { "P": "25", "x": "3.044526735", "y": "62.48" },
            { "P": "30", "x": "3.194615973", "y": "60.18" },
            { "P": "40", "x": "3.465669382", "y": "56.13" },
            { "P": "50", "x": "3.719016485", "y": "52.45" },
            { "P": "60", "x": "3.972363589", "y": "48.88" },
            { "P": "70", "x": "4.243416998", "y": "45.18" },
            { "P": "75", "x": "4.393506236", "y": "43.18" },
            { "P": "80", "x": "4.560637719", "y": "41" },
            { "P": "85", "x": "4.755449875", "y": "38.52" },
            { "P": "90", "x": "5.000568051", "y": "35.47" },
            { "P": "95", "x": "5.363870112", "y": "31.14" },
            { "P": "97", "x": "5.599810094", "y": "28.43" },
            { "P": "99", "x": "6.045364359", "y": "23.55" },
            { "P": "99.9", "x": "6.809248792", "y": "15.87" },
            { "P": "99.99", "x": "7.438032971", "y": "10.17" }
        ],
        '娄家村水文模型2': [
            { "P": "0.03", "x": "1.79", "y": "88.4568384" },
            { "P": "0.05", "x": "2.11", "y": "80.80031567" },
            { "P": "0.08", "x": "2.32", "y": "78.7161024" },
            { "P": "0.11", "x": "2.48", "y": "69.1617312" },
            { "P": "0.14", "x": "2.62", "y": "68.306544" },
            { "P": "0.16", "x": "2.73", "y": "65.3844096" },
            { "P": "0.19", "x": "2.84", "y": "64.23116341" },
            { "P": "0.22", "x": "2.93", "y": "63.8894304" },
            { "P": "0.24", "x": "3.02", "y": "62.7973344" },
            { "P": "0.27", "x": "3.11", "y": "61.022592" },
            { "P": "0.30", "x": "3.19", "y": "59.6572128" },
            { "P": "0.32", "x": "3.26", "y": "58.8830688" },
            { "P": "0.35", "x": "3.34", "y": "58.13222164" },
            { "P": "0.38", "x": "3.41", "y": "56.0910528" },
            { "P": "0.41", "x": "3.48", "y": "55.6990383" },
            { "P": "0.43", "x": "3.55", "y": "55.5773184" },
            { "P": "0.46", "x": "3.62", "y": "55.4204703" },
            { "P": "0.49", "x": "3.69", "y": "54.8853408" },
            { "P": "0.51", "x": "3.75", "y": "52.0535808" },
            { "P": "0.54", "x": "3.82", "y": "51.6476736" },
            { "P": "0.57", "x": "3.89", "y": "50.6892384" },
            { "P": "0.59", "x": "3.96", "y": "50.02962374" },
            { "P": "0.62", "x": "4.03", "y": "48.0662208" },
            { "P": "0.65", "x": "4.10", "y": "47.6112384" },
            { "P": "0.68", "x": "4.17", "y": "46.8997344" },
            { "P": "0.70", "x": "4.25", "y": "45.5888736" },
            { "P": "0.73", "x": "4.33", "y": "45.47878938" },
            { "P": "0.76", "x": "4.41", "y": "44.32143541" },
            { "P": "0.78", "x": "4.50", "y": "39.4561152" },
            { "P": "0.81", "x": "4.60", "y": "39.345264" },
            { "P": "0.84", "x": "4.70", "y": "38.0053728" },
            { "P": "0.86", "x": "4.82", "y": "35.0774496" },
            { "P": "0.89", "x": "4.96", "y": "34.8967008" },
            { "P": "0.92", "x": "5.12", "y": "32.54558282" },
            { "P": "0.95", "x": "5.33", "y": "30.7669536" },
            { "P": "0.97", "x": "5.65", "y": "28.7609184" }
        ],
        '娄家村水文模型3': [
            { "P": "72.5", "x": "4.316776611", "y": "44.2" }
        ],
        '娄家村统计模型1': [
            { "P": "0.01", "x": "0", "y": "117.82" },
            { "P": "0.0333", "x": "0.315810296", "y": "111.29" },
            { "P": "0.05", "x": "0.428489754", "y": "109" },
            { "P": "0.1", "x": "0.628784179", "y": "105" },
            { "P": "0.2", "x": "0.840854746", "y": "100.84" },
            { "P": "0.3333", "x": "1.005931458", "y": "97.66" },
            { "P": "0.5", "x": "1.143187182", "y": "95.06" },
            { "P": "1", "x": "1.392668611", "y": "90.41" },
            { "P": "2", "x": "1.665267575", "y": "85.46" },
            { "P": "3.3333", "x": "1.885097359", "y": "81.58" },
            { "P": "5", "x": "2.074162859", "y": "78.3" },
            { "P": "10", "x": "2.43746492", "y": "72.18" },
            { "P": "20", "x": "2.877395252", "y": "65.09" },
            { "P": "25", "x": "3.044526735", "y": "62.48" },
            { "P": "30", "x": "3.194615973", "y": "60.18" },
            { "P": "40", "x": "3.465669382", "y": "56.13" },
            { "P": "50", "x": "3.719016485", "y": "52.45" },
            { "P": "60", "x": "3.972363589", "y": "48.88" },
            { "P": "70", "x": "4.243416998", "y": "45.18" },
            { "P": "75", "x": "4.393506236", "y": "43.18" },
            { "P": "80", "x": "4.560637719", "y": "41" },
            { "P": "85", "x": "4.755449875", "y": "38.52" },
            { "P": "90", "x": "5.000568051", "y": "35.47" },
            { "P": "95", "x": "5.363870112", "y": "31.14" },
            { "P": "97", "x": "5.599810094", "y": "28.43" },
            { "P": "99", "x": "6.045364359", "y": "23.55" },
            { "P": "99.9", "x": "6.809248792", "y": "15.87" },
            { "P": "99.99", "x": "7.438032971", "y": "10.17" }
        ],
        '娄家村统计模型2': [
            { "P": "0.03", "x": "1.79", "y": "88.4568384" },
            { "P": "0.05", "x": "2.11", "y": "80.80031567" },
            { "P": "0.08", "x": "2.32", "y": "78.7161024" },
            { "P": "0.11", "x": "2.48", "y": "69.1617312" },
            { "P": "0.14", "x": "2.62", "y": "68.306544" },
            { "P": "0.16", "x": "2.73", "y": "65.3844096" },
            { "P": "0.19", "x": "2.84", "y": "64.23116341" },
            { "P": "0.22", "x": "2.93", "y": "63.8894304" },
            { "P": "0.24", "x": "3.02", "y": "62.7973344" },
            { "P": "0.27", "x": "3.11", "y": "61.022592" },
            { "P": "0.30", "x": "3.19", "y": "59.6572128" },
            { "P": "0.32", "x": "3.26", "y": "58.8830688" },
            { "P": "0.35", "x": "3.34", "y": "58.13222164" },
            { "P": "0.38", "x": "3.41", "y": "56.0910528" },
            { "P": "0.41", "x": "3.48", "y": "55.6990383" },
            { "P": "0.43", "x": "3.55", "y": "55.5773184" },
            { "P": "0.46", "x": "3.62", "y": "55.4204703" },
            { "P": "0.49", "x": "3.69", "y": "54.8853408" },
            { "P": "0.51", "x": "3.75", "y": "52.0535808" },
            { "P": "0.54", "x": "3.82", "y": "51.6476736" },
            { "P": "0.57", "x": "3.89", "y": "50.6892384" },
            { "P": "0.59", "x": "3.96", "y": "50.02962374" },
            { "P": "0.62", "x": "4.03", "y": "48.0662208" },
            { "P": "0.65", "x": "4.10", "y": "47.6112384" },
            { "P": "0.68", "x": "4.17", "y": "46.8997344" },
            { "P": "0.70", "x": "4.25", "y": "45.5888736" },
            { "P": "0.73", "x": "4.33", "y": "45.47878938" },
            { "P": "0.76", "x": "4.41", "y": "44.32143541" },
            { "P": "0.78", "x": "4.50", "y": "39.4561152" },
            { "P": "0.81", "x": "4.60", "y": "39.345264" },
            { "P": "0.84", "x": "4.70", "y": "38.0053728" },
            { "P": "0.86", "x": "4.82", "y": "35.0774496" },
            { "P": "0.89", "x": "4.96", "y": "34.8967008" },
            { "P": "0.92", "x": "5.12", "y": "32.54558282" },
            { "P": "0.95", "x": "5.33", "y": "30.7669536" },
            { "P": "0.97", "x": "5.65", "y": "28.7609184" }
        ],
        '娄家村统计模型3': [
            { "P": "85.4", "x": "4.772760788", "y": "38.3" }
        ],
        '廖家湾水文模型1': [
            { "P": "0.01", "x": "0", "y": "222.44" },
            { "P": "0.0333", "x": "0.315810296", "y": "209.33" },
            { "P": "0.05", "x": "0.428489754", "y": "204.74" },
            { "P": "0.1", "x": "0.628784179", "y": "196.69" },
            { "P": "0.2", "x": "0.840854746", "y": "188.33" },
            { "P": "0.3333", "x": "1.005931458", "y": "181.93" },
            { "P": "0.5", "x": "1.143187182", "y": "176.68" },
            { "P": "1", "x": "1.392668611", "y": "167.31" },
            { "P": "2", "x": "1.665267575", "y": "157.33" },
            { "P": "3.3333", "x": "1.885097359", "y": "149.47" },
            { "P": "5", "x": "2.074162859", "y": "142.84" },
            { "P": "10", "x": "2.43746492", "y": "130.45" },
            { "P": "20", "x": "2.877395252", "y": "116.04" },
            { "P": "25", "x": "3.044526735", "y": "110.73" },
            { "P": "30", "x": "3.194615973", "y": "106.05" },
            { "P": "40", "x": "3.465669382", "y": "97.78" },
            { "P": "50", "x": "3.719016485", "y": "90.27" },
            { "P": "60", "x": "3.972363589", "y": "82.96" },
            { "P": "70", "x": "4.243416998", "y": "75.37" },
            { "P": "75", "x": "4.393506236", "y": "71.27" },
            { "P": "80", "x": "4.560637719", "y": "66.78" },
            { "P": "85", "x": "4.755449875", "y": "61.66" },
            { "P": "90", "x": "5.000568051", "y": "55.39" },
            { "P": "95", "x": "5.363870112", "y": "46.43" },
            { "P": "97", "x": "5.599810094", "y": "40.82" },
            { "P": "99", "x": "6.045364359", "y": "30.68" },
            { "P": "99.9", "x": "6.809248792", "y": "14.61" },
            { "P": "99.99", "x": "7.438032971", "y": "2.6" }
        ],
        '廖家湾水文模型2': [
            { "P": "0.03", "x": "1.79", "y": "152.9369856" },
            { "P": "0.05", "x": "2.11", "y": "151.2062208" },
            { "P": "0.08", "x": "2.32", "y": "136.0226089" },
            { "P": "0.11", "x": "2.48", "y": "135.0709344" },
            { "P": "0.14", "x": "2.62", "y": "123.811632" },
            { "P": "0.16", "x": "2.73", "y": "118.0804608" },
            { "P": "0.19", "x": "2.84", "y": "117.8171174" },
            { "P": "0.22", "x": "2.93", "y": "114.2474976" },
            { "P": "0.24", "x": "3.02", "y": "113.776272" },
            { "P": "0.27", "x": "3.11", "y": "108.8608896" },
            { "P": "0.30", "x": "3.19", "y": "108.3605472" },
            { "P": "0.32", "x": "3.26", "y": "106.8729984" },
            { "P": "0.35", "x": "3.34", "y": "104.0114304" },
            { "P": "0.38", "x": "3.41", "y": "102.3964416" },
            { "P": "0.41", "x": "3.48", "y": "101.4719052" },
            { "P": "0.43", "x": "3.55", "y": "99.6516059" },
            { "P": "0.46", "x": "3.62", "y": "95.8572576" },
            { "P": "0.49", "x": "3.69", "y": "93.0979872" },
            { "P": "0.51", "x": "3.75", "y": "89.45453508" },
            { "P": "0.54", "x": "3.82", "y": "87.46337272" },
            { "P": "0.57", "x": "3.89", "y": "87.4152" },
            { "P": "0.59", "x": "3.96", "y": "86.1726816" },
            { "P": "0.62", "x": "4.03", "y": "85.3432416" },
            { "P": "0.65", "x": "4.10", "y": "74.92505548" },
            { "P": "0.68", "x": "4.17", "y": "73.0606176" },
            { "P": "0.70", "x": "4.25", "y": "71.5801536" },
            { "P": "0.73", "x": "4.33", "y": "66.86743515" },
            { "P": "0.76", "x": "4.41", "y": "64.6424064" },
            { "P": "0.78", "x": "4.50", "y": "61.525008" },
            { "P": "0.81", "x": "4.60", "y": "59.5981152" },
            { "P": "0.84", "x": "4.70", "y": "57.1781376" },
            { "P": "0.86", "x": "4.82", "y": "55.4364" },
            { "P": "0.89", "x": "4.96", "y": "54.1969056" },
            { "P": "0.92", "x": "5.12", "y": "52.3962432" },
            { "P": "0.95", "x": "5.33", "y": "51.94211843" },
            { "P": "0.97", "x": "5.65", "y": "44.7615936" }

        ],
        '廖家湾水文模型3': [
            { "P": "66.49", "x": "4.144890021", "y": "78.1" }
        ],
        '廖家湾统计模型1': [
            { "P": "0.01", "x": "0", "y": "222.44" },
            { "P": "0.0333", "x": "0.315810296", "y": "209.33" },
            { "P": "0.05", "x": "0.428489754", "y": "204.74" },
            { "P": "0.1", "x": "0.628784179", "y": "196.69" },
            { "P": "0.2", "x": "0.840854746", "y": "188.33" },
            { "P": "0.3333", "x": "1.005931458", "y": "181.93" },
            { "P": "0.5", "x": "1.143187182", "y": "176.68" },
            { "P": "1", "x": "1.392668611", "y": "167.31" },
            { "P": "2", "x": "1.665267575", "y": "157.33" },
            { "P": "3.3333", "x": "1.885097359", "y": "149.47" },
            { "P": "5", "x": "2.074162859", "y": "142.84" },
            { "P": "10", "x": "2.43746492", "y": "130.45" },
            { "P": "20", "x": "2.877395252", "y": "116.04" },
            { "P": "25", "x": "3.044526735", "y": "110.73" },
            { "P": "30", "x": "3.194615973", "y": "106.05" },
            { "P": "40", "x": "3.465669382", "y": "97.78" },
            { "P": "50", "x": "3.719016485", "y": "90.27" },
            { "P": "60", "x": "3.972363589", "y": "82.96" },
            { "P": "70", "x": "4.243416998", "y": "75.37" },
            { "P": "75", "x": "4.393506236", "y": "71.27" },
            { "P": "80", "x": "4.560637719", "y": "66.78" },
            { "P": "85", "x": "4.755449875", "y": "61.66" },
            { "P": "90", "x": "5.000568051", "y": "55.39" },
            { "P": "95", "x": "5.363870112", "y": "46.43" },
            { "P": "97", "x": "5.599810094", "y": "40.82" },
            { "P": "99", "x": "6.045364359", "y": "30.68" },
            { "P": "99.9", "x": "6.809248792", "y": "14.61" },
            { "P": "99.99", "x": "7.438032971", "y": "2.6" }

        ],
        '廖家湾统计模型2': [
            { "P": "0.03", "x": "1.79", "y": "152.9369856" },
            { "P": "0.05", "x": "2.11", "y": "151.2062208" },
            { "P": "0.08", "x": "2.32", "y": "136.0226089" },
            { "P": "0.11", "x": "2.48", "y": "135.0709344" },
            { "P": "0.14", "x": "2.62", "y": "123.811632" },
            { "P": "0.16", "x": "2.73", "y": "118.0804608" },
            { "P": "0.19", "x": "2.84", "y": "117.8171174" },
            { "P": "0.22", "x": "2.93", "y": "114.2474976" },
            { "P": "0.24", "x": "3.02", "y": "113.776272" },
            { "P": "0.27", "x": "3.11", "y": "108.8608896" },
            { "P": "0.30", "x": "3.19", "y": "108.3605472" },
            { "P": "0.32", "x": "3.26", "y": "106.8729984" },
            { "P": "0.35", "x": "3.34", "y": "104.0114304" },
            { "P": "0.38", "x": "3.41", "y": "102.3964416" },
            { "P": "0.41", "x": "3.48", "y": "101.4719052" },
            { "P": "0.43", "x": "3.55", "y": "99.6516059" },
            { "P": "0.46", "x": "3.62", "y": "95.8572576" },
            { "P": "0.49", "x": "3.69", "y": "93.0979872" },
            { "P": "0.51", "x": "3.75", "y": "89.45453508" },
            { "P": "0.54", "x": "3.82", "y": "87.46337272" },
            { "P": "0.57", "x": "3.89", "y": "87.4152" },
            { "P": "0.59", "x": "3.96", "y": "86.1726816" },
            { "P": "0.62", "x": "4.03", "y": "85.3432416" },
            { "P": "0.65", "x": "4.10", "y": "74.92505548" },
            { "P": "0.68", "x": "4.17", "y": "73.0606176" },
            { "P": "0.70", "x": "4.25", "y": "71.5801536" },
            { "P": "0.73", "x": "4.33", "y": "66.86743515" },
            { "P": "0.76", "x": "4.41", "y": "64.6424064" },
            { "P": "0.78", "x": "4.50", "y": "61.525008" },
            { "P": "0.81", "x": "4.60", "y": "59.5981152" },
            { "P": "0.84", "x": "4.70", "y": "57.1781376" },
            { "P": "0.86", "x": "4.82", "y": "55.4364" },
            { "P": "0.89", "x": "4.96", "y": "54.1969056" },
            { "P": "0.92", "x": "5.12", "y": "52.3962432" },
            { "P": "0.95", "x": "5.33", "y": "51.94211843" },
            { "P": "0.97", "x": "5.65", "y": "44.7615936" }
        ],
        '廖家湾统计模型3': [
            { "P": "77.6", "x": "4.47777003", "y": "69.0" }
        ]
    }
}

PIIFactory.prototype = {
    getParamGridData: function (area) {
        return this.piiMap[area];
    },
    formatData: function (name) {
        var dataList = this.getParamGridData(name);
        var returnList = [];
        if (typeof dataList != 'undefined') {
            for (var i = 0; i < dataList.length; i++) {
                var temp = [];
                temp.push(parseFloat(dataList[i].x), parseFloat(dataList[i].y));
                returnList.push(temp);
            }
        }
        return returnList;
    },
    formatDataHighcharts: function (name, x) {
        var dataList, returnHighParam = 0.1;
        for (var j = 1; j < 4; j++) {
            var temp = name + j;
            dataList = this.getParamGridData(temp);
            for (var i = 0; i < dataList.length; i++) {
                if (dataList[i].x == x) {
                    returnHighParam = Math.round((parseFloat(dataList[i].P)) * 10) / 10;
                }
            }
        }
        return returnHighParam;
    }
}

var piiData = new PIIFactory();

var selectG,selectR;


Ext.define('Admin.view.runoff.RunoffController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.runoffController',
    views: ['Admin.view.runoff.Runoff'],
    /* runoff tab-content 初始化 */
    // initTest:function () {
    //     Ext.getCmp(runoffTabpanelId).setActiveItem(1);
    // },
    afterRenderInit: function () {
        var me = this;
        $('#wd-tab').on('click', 'a', function () {
            var tabNum = $(this).attr('category');
            var isCurrentTabInit;
            if (tabNum === '1') {
                isCurrentTabInit = me.getView().getIsWdTab1Init();
            } else if (tabNum === '2') {
                isCurrentTabInit = me.getView().getIsWdTab2Init();
            } else if (tabNum === '3') {
                isCurrentTabInit = me.getView().getIsWdTab3Init();
            }
            if (!isCurrentTabInit) {
                me.initTabContent(tabNum);
            }
        });
        $('#wd-tab > li:eq(0) > a').trigger('click');
    },
    /* 初始化对应页签的内容 */
    initTest: function (event) {
        var myMask = new Ext.LoadMask($.dispatch.componentQuery('runoff'), { msg: "正在加载..." });
        myMask.show();
        var me = this;
        // $('#needWaterCal').off('click');
        // $('#needWaterCal').on('click', function () {
        Ext.getCmp(runoffTabpanelId).setActiveItem(1);

        var data1 = [], data2 = [], data3 = [],data_categories=[],data4,data5,data6, title = {};
        returnListTab2Chart=me.clickRunoffTab2Chart();
        //returnListTab2Chart[0] ：name
        //returnListTab2Chart[1] :统计模型
        $.when(runoffData_1.loadData4(returnListTab2Chart[0],$.dispatch.getProCd(),$.dispatch.getDtype())
            ,runoffData_1.getYear($.dispatch.getProCd())).then(function () {
            var name = returnListTab2Chart[0];
            var currentData=(runoffData_1.forecastData)[name];
            Ext.data.StoreManager.lookup('runoff_store3').setData(currentData);

            title = {
                text: returnListTab2Chart[0] + '区间'+runoffData_1.fyear+'年预报结果'
            };
            for (var i = 0; i < currentData.length; i++) {
                data1.push(parseFloat(currentData[i].p1));
                data2.push(parseFloat(currentData[i].p2));
                data3.push(parseFloat(currentData[i].p4));
                data_categories.push(currentData[i].month);
            }
            if($.dispatch.getDtype()==='year' || ($.dispatch.getDtype()==='month' && returnListTab2Chart[0]==='洪门')){
                data1.pop();
                data2.pop();
                data3.pop();
                data_categories.pop();
            }
            sectionChart.series[0].setData(data1);
            sectionChart.series[1].setData(data2);
            sectionChart.series[2].setData(data3);
            sectionChart.xAxis[0].setCategories(data_categories);
            sectionChart.setTitle(title);
            if(returnListTab2Chart.length>0){
                var temp=returnListTab2Chart[1].substring(0,returnListTab2Chart[1].indexOf("▼"));
                if(piiData.formatData(returnListTab2Chart[0]+temp+"1").length>0){
                    data4=piiData.formatData(returnListTab2Chart[0]+temp+"1");
                    data5=piiData.formatData(returnListTab2Chart[0]+temp+"2");
                    data6=piiData.formatData(returnListTab2Chart[0]+temp+"3");
                }else{
                    data4=piiData.formatData("廖坊水文模型1");
                    data5=piiData.formatData("廖坊水文模型2");
                    data6=piiData.formatData("廖坊水文模型3");
                }
            }else{
                data4=piiData.formatData("廖坊水文模型1");
                data5=piiData.formatData("廖坊水文模型2");
                data6=piiData.formatData("廖坊水文模型3");
            }
            sectionChart2.series[0].setData(data4);
            sectionChart2.series[1].setData(data5);
            sectionChart2.series[2].setData(data6);
            myMask.hide();
            me.changeStatus(selectG,selectR);
        })
        // });
    },
    changeStatus:function (selectG, selectR) {
        selectR.data.status="完成";
        selectR.commit();
        selectG.getView().refresh();
    },
    clickRunoffTab2Chart: function (_grid, _selectRrow) {




        var me = this;
        if (typeof _grid!=="undefined" && typeof _selectRrow!=="undefined"){
            selectG=_grid;
            selectR=_selectRrow;
            if (_selectRrow.data.forecastType.indexOf('已有方案')>-1) {

            } else if (_selectRrow.data.forecastType.indexOf('统计模型')>-1) {
                $("#forecastModel").text("").text("预报模型   灰色自记忆模型");
            } else if (_selectRrow.data.forecastType.indexOf('水文模型')>-1) {
                $("#forecastModel").text("").text("预报模型   水均衡模型");
            }
        }


        if (typeof _selectRrow != 'undefined') {
            var name = _selectRrow.data.comeWater.split("以上")[0];
            var type = _selectRrow.data.forecastType;

            if (returnListTab2Chart.length > 0) {
                returnListTab2Chart.splice(0, 1, name);
                returnListTab2Chart.splice(1, 1, type)
            } else {
                returnListTab2Chart.push(name);
                returnListTab2Chart.push(type);
            }

            var currentData = [
                {
                    paramName: '参数w',
                    paramValue: '1.66',
                    paramExplain: ''
                }];
            if (name .indexOf( '廖家湾')> -1) {
                if (type.indexOf("水文模型") > -1) {
                    currentData = [
                        {
                            paramName: '参数w',
                            paramValue: '1.8',
                            paramExplain: ''
                        }]
                } else if (type.indexOf("统计模型") > -1) {
                    currentData = [
                        {
                            paramName: '回溯阶数p',
                            paramValue: '8',
                            paramExplain: ''
                        }, {
                            paramName: '动力核参数',
                            paramValue: 'a=0.04867',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'b0=0.047',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'b1=0.003',
                            paramExplain: ''
                        }, {
                            paramName: '自记忆函数参数',
                            paramValue: 'A1=3.482',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A2=-3.1',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A3=0.482',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A4=-2.799',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A5=3.432',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A6=-3.332',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A7=4.598',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A8=-5.407',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A9=3.633',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B1=-0.711',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B2=4.301',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B3=0.713',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B4=-2.129',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B5=-0.12',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B6=1.179',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B7=0.21',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B8=0.443',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B9=-1.326',
                            paramExplain: ''
                        }]
                }
            } else if (name .indexOf( '李家渡')> -1) {
                if (type.indexOf("水文模型") > -1) {
                    currentData = [
                        {
                            paramName: '参数w',
                            paramValue: '3.163',
                            paramExplain: ''
                        }]
                }
            } else if (name .indexOf( '洪门')> -1) {
                if (type.indexOf("水文模型") > -1) {
                    currentData = [
                        {
                            paramName: '参数w',
                            paramValue: '3.163',
                            paramExplain: ''
                        }]
                }
            }else if (name.indexOf('廖坊')> -1) {
                if (type.indexOf("水文模型") > -1) {
                    currentData = [
                        {
                            paramName: '参数w',
                            paramValue: '1.85',
                            paramExplain: ''
                        }]
                } else if (type.indexOf("统计模型") > -1) {
                    currentData = [
                        {
                            paramName: '回溯阶数p',
                            paramValue: '7',
                            paramExplain: ''
                        }, {
                            paramName: '动力核参数',
                            paramValue: 'a=-0.1414',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'b0=0.537',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'b1=0.083',
                            paramExplain: ''
                        }, {
                            paramName: '自记忆函数参数',
                            paramValue: 'A1=0.714',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A2=-1.746',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A3=0.467',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A4=1.683',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A5=-3.171',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A6=1.722',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A7=-1.583',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A8=2.92',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B1=0.14',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B2=0.072',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B3=-0.831',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B4=1.708',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B5=0.323',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B6=-1.627',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B7=-2.209',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B8=-0.897',
                            paramExplain: ''
                        }]
                }
            }else if (name .indexOf('娄家村')>-1) {
                if (type.indexOf("水文模型") > -1) {
                    currentData = [
                        {
                            paramName: '参数w',
                            paramValue: '1.924',
                            paramExplain: ''
                        }]
                } else if (type.indexOf("统计模型") > -1) {
                    currentData = [
                        {
                            paramName: '回溯阶数p',
                            paramValue: '57',
                            paramExplain: ''
                        }, {
                            paramName: '动力核参数',
                            paramValue: 'a=-0.61465',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'b0=0.018',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'b1=-0.018',
                            paramExplain: ''
                        }, {
                            paramName: '自记忆函数参数',
                            paramValue: 'A1=-4.201',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A2=9.504',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A3=-12.249',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A4=12.813',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A5=-9.79',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'A6=4.913',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B1=0.199',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B2=1.385',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B3=-0.879',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B4=-0.462',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B5=1.597',
                            paramExplain: ''
                        }, {
                            paramName: '',
                            paramValue: 'B6=-2.064',
                            paramExplain: ''
                        }]
                }
            }
            Ext.data.StoreManager.lookup('runoff_store2').setData(currentData);



            if(name === "南城"){
                name = "南丰";
            }
            if(runoffData_1.forecastData != null && (runoffData_1.forecastData)[name]!=null  && _selectRrow.data.forecastType.indexOf(returnListTab2Chart[1])>-1){

                var data1 = [], data2 = [], data3 = [],data_categories=[],data4,data5,data6,title = {};
                var currentData1=(runoffData_1.forecastData)[name];
                Ext.data.StoreManager.lookup('runoff_store3').setData(currentData1);

                title = {
                    text: name + '区间'+runoffData_1.fyear+'年预报结果'
                };
                for (var i = 0; i < currentData1.length; i++) {
                    data1.push(parseFloat(currentData1[i].p1));
                    data2.push(parseFloat(currentData1[i].p2));
                    data3.push(parseFloat(currentData1[i].p4));
                    data_categories.push(currentData1[i].month);
                }
                if($.dispatch.getDtype()==='year' || ($.dispatch.getDtype()==='month' && returnListTab2Chart[0]==='洪门')){
                    data1.pop();
                    data2.pop();
                    data3.pop();
                    data_categories.pop();
                }
                sectionChart.series[0].setData(data1);
                sectionChart.series[1].setData(data2);
                sectionChart.series[2].setData(data3);
                sectionChart.xAxis[0].setCategories(data_categories);
                sectionChart.setTitle(title);
                if(returnListTab2Chart.length>0){
                    var temp=returnListTab2Chart[1].substring(0,returnListTab2Chart[1].indexOf("▼"));
                    if(piiData.formatData(returnListTab2Chart[0]+temp+"1").length>0){
                        data4=piiData.formatData(returnListTab2Chart[0]+temp+"1");
                        data5=piiData.formatData(returnListTab2Chart[0]+temp+"2");
                        data6=piiData.formatData(returnListTab2Chart[0]+temp+"3");
                    }else{
                        data4=piiData.formatData("廖坊水文模型1");
                        data5=piiData.formatData("廖坊水文模型2");
                        data6=piiData.formatData("廖坊水文模型3");
                    }
                }else{
                    data4=piiData.formatData("廖坊水文模型1");
                    data5=piiData.formatData("廖坊水文模型2");
                    data6=piiData.formatData("廖坊水文模型3");
                }
                sectionChart2.series[0].setData(data4);
                sectionChart2.series[1].setData(data5);
                sectionChart2.series[2].setData(data6);
                myMask.hide();
                me.changeStatus(selectG,selectR);
            }
        }else{
            returnListTab2Chart.push("廖家湾");
            returnListTab2Chart.push("统计模型");
        }
        return returnListTab2Chart ;
    },
    changeRunoffTab2Chart: function (_this, newVal) {
        this.selectData = "";
        var me = this;
        if (typeof (newVal) != "undefined") {
            this.selectData = newVal.data.field2;
            if (this.selectData == '已有方案') {

            } else if (this.selectData == '统计模型') {
                $("#forecastModel").text("").text("预报模型   灰色自记忆模型");
            } else if (this.selectData == '水文模型') {
                $("#forecastModel").text("").text("预报模型   水均衡模型");
            }
        }
        return this.selectData;
    },
    changeStationName: function (_grid, _selectRrow) {
        var area = _selectRrow.get('stationName');
        $.when(runoffData_1.loadData2(area)).then(function () {
            Ext.data.StoreManager.lookup('runoff_store1').setData(runoffData_1.areaInfo_year);
        })
    },
    //点击刷新一年12个月的图表
    changeMonthData: function (_grid, _selectRrow) {

        var name = _selectRrow.get('stationName');
        var year = _selectRrow.get('YEAR');
        console.log('chart1', chart1);
        $.when(runoffData_1.loadData3(name,year)).then(function () {
            chart1.series[0].setData(runoffData_1.areaInfo_month);
            chart1.xAxis[0].setCategories(runoffData_1.formatDataYear(year));
        })
    },
    renderColor: function (_value) {
        var parseNum = parseFloat(_value);
        var color = '#333333';
        if (parseNum > 0) {
            color = '#FF0000';
        } else if (parseNum === 0) {
            color = '#333333';
        } else if (parseNum < 0) {
            color = '#00ff00';
        }
        return '<span style="color: ' + color + '">' + parseNum + '</span>';
    },
    initTabContent: function (tabNum) {
        var me = this;
        var thisView = me.getView();
        // var activeTabNum = $('.tab-content>div.active').attr('tab-number');
        if (tabNum === '1') {
            thisView.setIsWdTab1Init(true);
            me.initWdTab1Content();
        } else if (tabNum === '2') {
            thisView.setIsWdTab2Init(true);
            me.initWdTab2Content();

        } else if (tabNum === '3') {
            thisView.setIsWdTab3Init(true);
            me.initWdTab3Content();
        }
    },
    /* tab-content1 */
    initWdTab1Content: function () {
    },
    buildTab2Chart: function (dom) {
        var me = this;
        var domId = dom.el.id + '-body';
        chart1 = Highcharts.chart(domId, {
            title: {
                text: ' ',
                x: -20
            },
            xAxis: {
                categories: ['1981年1月', '1981年2月', '1981年3月', '1981年4月', '1981年5月', '1981年6月', '1981年7月', '1981年8月', '1981年9月', '1981年10月', '1981年11月', '1981年12月']
            },
            yAxis: {
                title: {
                    text: '流量（m³/s）'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            tooltip: {
                valueSuffix: 'm³/s'
            },
            legend: {
                align: 'center', //水平方向位置
                verticalAlign: 'top', //垂直方向位置
                x: 0, //距离x轴的距离
                y: 20 //距离Y轴的距离
            },
            series: [{
                name: '流量 ',
                data: [65.0626, 191.326, 764.065, 2017.77, 664.355, 441.603, 71.9977, 86.15, 55.9213, 180.416, 369.845, 138.59]
            }]
        });
    },
    /* tab-content3 */
    initWdTab3Content: function () {
        var me = this;
        setTimeout(function () {
            // me.buildTab3Chart1();
            // me.buildTab3Chart2();
        }, 0);
    },
    buildTab3Chart1: function (dom) {
        var domId = dom.el.id + '-body';
        sectionChart = Highcharts.chart(domId, {
            chart: {
                type: 'column'
            },
            title: {
                text: '李家渡区间2017年预报结果'
            },
            xAxis: {
                title: {
                    text: '月份'
                },
                gridLineWidth: 0,
                categories: [
                    '一月',
                    '二月',
                    '三月',
                    '四月',
                    '五月',
                    '六月',
                    '七月',
                    '八月',
                    '九月',
                    '十月',
                    '十一月',
                    '十二月'
                ],

                crosshair: true
            },
            yAxis: {
                title: {
                    text: '月平均流量（m³/s）'
                }
            },
            tooltip: {
                headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
                pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y:.1f} m³/s</b></td></tr>',
                footerFormat: '</table>',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [{
                name: '预报径流量',
                data: [3.3, 4.8, 19.9, 15.1, 62.7, 22.3, 6, 5, 7.7, 4.6, 2.8, 2.1]
            }, {
                name: '上一年径流量',
                data: [1.8, 2.0, 13.3, 5.2, 24.3, 38.8, 13.2, 7.2, 7.9, 6.0, 21.9, 21.5]
            }, {
                name: '多年平均',
                data: [4.0, 6.2, 13.8, 17.6, 18.9, 26.2, 11.5, 5.8, 4.4, 3.0, 5.1, 4.7]
            }],
            credits: {
                enabled: false
            }
        });
    },
    buildTab3Chart2: function (dom) {
        var name, type, data4, data5, data6;
        if (returnListTab2Chart.length > 0){
            name = returnListTab2Chart[0];
            type = returnListTab2Chart[1].substring(0, returnListTab2Chart[1].indexOf("▼"));
            if (piiData.formatData(returnListTab2Chart[0] + type + "1").length > 0) {
                data4 = piiData.formatData(returnListTab2Chart[0] + type + "1");
                data5 = piiData.formatData(returnListTab2Chart[0] + type + "2");
                data6 = piiData.formatData(returnListTab2Chart[0] + type + "3");
            } else {
                name = "廖坊"; type = "水文模型";
                data4 = piiData.formatData("廖坊水文模型1");
                data5 = piiData.formatData("廖坊水文模型2");
                data6 = piiData.formatData("廖坊水文模型3");
            }
        } else {
            name = "廖坊"; type = "水文模型";
            data4 = piiData.formatData("廖坊水文模型1");
            data5 = piiData.formatData("廖坊水文模型2");
            data6 = piiData.formatData("廖坊水文模型3");
        }
        var domId = dom.el.id + '-body';
        sectionChart2 = Highcharts.chart(domId, {
            xAxis: {
                min: 0.001,
                title: {
                    text: '频率（%）'
                },
                gridLineWidth: 0,
                categories: [0.01, 1, 5, 10, 50, 90, 95, 99, 99.99],
                crosshair: true
            },
            yAxis: {
                min: 0,
                title: {
                    text: '来水量（亿m³)'
                },
            },
            title: {
                text: '散点与线性回归线'
            },
            tooltip: {
                formatter: function () {
                    var s = '水量：' + Math.round((parseFloat(this.y)) * 10) / 10 + '亿m³' + '<br>' +
                        '频率：' + piiData.formatDataHighcharts(name + type, this.x) + '%';
                    return s;
                },
                shared: true
            },
            series: [{
                type: 'line',
                color: 'rgba(255,0,0, .5)',
                name: '理论频率',
                data: data4,
                marker: {
                    enabled: false
                },
                states: {
                    hover: {
                        lineWidth: 0
                    }
                },
                enableMouseTracking: false
            }, {
                type: 'scatter',
                color: 'rgba(50, 174, 205, .5)',
                name: '经验频率',
                data: data5,
                marker: {
                    symbol: "circle",
                    // fillColor: 'rgba(0, 0, 0, .5)',
                    radius: 3
                }
            }, {
                type: 'scatter',
                cursor: 'pointer',
                color: 'rgba(0, 0, 255, .5)',
                name: '预报值',
                //[x,y]
                data: data6,
                dataLabels: {
                    zIndex: 8,
                    enabled: true
                },
                marker: {
                    symbol: "circle",
                    radius: 4
                }
            }]
        });
    },
    initData:function () {
        var me = this;
        var myMask = new Ext.LoadMask($.dispatch.componentQuery('runoff'), { msg: "正在加载..." });
        myMask.show();
        $.when(runoffData_1.loadData1()).then(function () {
            Ext.data.StoreManager.lookup('runoff_store0').setData(runoffData_1.areaInfo);
            me.lookupReference('runoff_store0_table').getSelectionModel().select(0, true);
            const startTime= runoffData_1.areaInfo[0]["startTime"];
            const staName= runoffData_1.areaInfo[0]["stationName"];
            $.when(runoffData_1.loadData2(staName)).then(function () {
                Ext.data.StoreManager.lookup('runoff_store1').setData(runoffData_1.areaInfo_year);
                $.when(runoffData_1.loadData3(staName,startTime)).then(function () {
                    chart1.series[0].setData(runoffData_1.areaInfo_month);
                    chart1.xAxis[0].setCategories(runoffData_1.formatDataYear(startTime));
                    myMask.hide();
                })
            })
        })
    }
})
var runoffData_1= new RunoffDataFactory();
function RunoffDataFactory () {
    this.areaInfo = null;
    this.areaInfo_year = null;
    this.areaInfo_month = null;
    this.forecastData=null;
    this.fyear=null;
    var me = this;
    me.loadData1 = function () {
        var def = $.Deferred();
        $.getJSON("/jsite-szy-dispatch/a/szy/dispatch/ddsDDayp/getStationInfo", function (data) {
            me.areaInfo = data;
            def.resolve();
        });
        return def.promise();
    }
    me.loadData2=function(stationName){
        var def = $.Deferred();
        $.getJSON("/jsite-szy-dispatch/a/szy/dispatch/ddsDDayp/getAvgToYear/"+stationName, function (data) {
            me.areaInfo_year = data;
            def.resolve();
        });
        return def.promise();
    }
    me.loadData3=function(stationName,year){
        var def = $.Deferred();
        $.getJSON("/jsite-szy-dispatch/a/szy/dispatch/ddsDDayp/getAvgToMonth/"+stationName+"/"+year, function (data) {
            me.areaInfo_month = data;
            def.resolve();
        });
        return def.promise();
    };
    me.loadData4=function(stationName,year,type){
        var model = 1;
        if($("#forecastModel").text().indexOf("灰色自记忆模型") > -1){
            model = 1;
        }else if($("#forecastModel").text().indexOf("水均衡模型") > -1){
            model = 2;
        }
        var def = $.Deferred();
        $.getJSON("/jsite-szy-dispatch/a/szy/dispatch/ddsDDayp/getForecatData/"+stationName+"/"+year+"/"+type+"/"+model, function (data) {
            me.forecastData = data;
            def.resolve();
        });
        return def.promise();
    };
    me.formatDataYear=function (year) {
        var yearList = [];
        for (var i = 1; i < 13; i++) {
            yearList.push(year + "-" + i)
        }
        return yearList;
    }
    me.getYear=function (id) {
        var def = $.Deferred();
        $.getJSON("/jsite-szy-dispatch/a/szy/dispatch/ddsDDayp/getYear/"+id, function (data) {
            me.fyear = data;
            def.resolve();
        });
        return def.promise();
    }
}

